
//用户接口相关的函数
import request from "../untils/request.js"

/**
 * 
 *  post
 *  
 */

// 获取密钥
export const getSecurityKey = () => {
  return axiosInstance.get('/outpatient/index/key');
};

//登录函数
export const login = (data) => {
    return request.post("/outpatient/login",data)
}

//添加账号
export const insertUser = (data) => {
    return request.post("/outpatient/insertUser",data)
}
//编辑账号
// export const usersEdit = (data) => {
//     return request.post("/outpatient/updateUser", data)
//     }

//添加员工档案
export const addStaff = (data) => {
	return request.post("/outpatient/addStaff", data)
}

//修改员工档案
export const updateStaff = (data) => {
	return request.post("/outpatient/updateStaff", data)
}
// 新增菜单
export const addMenu = (data) => {
    return request.post("/outpatient/menu/add", data )
}	

// 添加用户
export const addUser = (data) => {
    return request.post("/outpatient/user/insertUser", data )
}	
// 更新 修改用户
export const updateUser = (data) => {
    return request.post("/outpatient/user/update", data )
}

// 重置 修改密码
export const editPwd = (data) => {
    return request.post("/outpatient/user/editPwd", data )
}


// 添加角色
export const addRole = (data) => {
    return request.post("/outpatient/role/add", data )
}	
// 修改角色
export const editRole = (data) => {
    return request.post("/outpatient/role/edit", data )
}



// 修改菜单
export const editMenu = (data) => {
    return request.post("/outpatient/menu/edit", data )
}


/**
 * 
 * get 
 *  
 */

//登出
export const loginOut = (params) => {
    return request.get("/outpatient/loginOut", { params })
}

//获取用户信息(根据用户id)
export const GetUserInfo = (params) => {
    return request.get("/outpatient/user/getUserInfo", { params })
}

//账号列表
export const usersList = (params) => {
    return request.get("/outpatient/selectList", { params })
}

// 获取员工档案
export const getStaff = (params) => {
	return request.get("/outpatient/get", { params })
}
// 删除角色
export const deleteRole = (params) => {
    return request.get("/outpatient/role/delete", { params })
}
// 检查是否有当前角色
export const checkRole = (params) => {
    return request.get("/outpatient/role/check", { params } )
}

// 三级联动
export const getArea = (params) => {
    return request.get("/outpatient/getArea", { params } )
}
// 三级联动
export const getArea2 = (params) => {
    return request.get("/outpatient/getArea2", { params } )
}
// 三级联动
export const getArea3 = (params) => {
    return request.get("/outpatient/getArea3", { params } )
}
//获取账号信息
export const usersInfo = () => {
    return request.get("/users/info")
}

// 新增隶属科室 = >列表
export const findAttribute = (params) => {
    return request.get("/outpatient/findAttribute", { params })
    }
	
// 获取所有权限动态菜单 => 全部菜单 查询
export const AllMenu = (params) => {
    return request.get("/outpatient/menu", { params } )
}

// 获取角色的所有菜单id
export const roleMenuIds = (params) => {
    return request.get("/outpatient/role/roleMenuIds", { params } )
}

// 获取权限动态菜单 => 权限菜单
export const searchUserMenu = (params) => {
    return request.get("/outpatient/menu/searchUserMenu", { params })
}
// 获取用户列表
export const getAllUser = (params) => {
    return request.get("/outpatient/user/page", { params })
}

// 所有角色
export const roleList = (params) => {
    return request.get("/outpatient/role/list", { params } )
}

// 获取用户信息
export  const getuserInfo = (params) => {
  return request.get("/outpatient/user/getUserInfo",{ params } )
}
// 获取角色列表
export const getAllRole = (params) => {
  return request.get("/outpatient/role/page", { params })
}

// 删除菜单
export const removeMenu = (params) => {
    return request.get("/outpatient/menu/remove", {params})
}
// /outpatient/menu	

//图片修改上传
// export const builderImage = (params) => {
// 	return request.get("/outpatient/builderImage",{params})
// 	}
export function builderImage(params) {
  return request({
    url: '/outpatient/builderImage',
    method: 'post',
    params
  })
}
/**
 * 
 * DELETE 
 *  
 */
//删除用户
// export const deleteUser = (data) => {
//   return request.delete("/outpatient/deleteUser",{ data })
// }
//删除账号
export const deleteUser = (data) => {
  return request.delete("/outpatient/deleteUser",{ data })
}


// export function leftMenu(params) {
//   return request({
// 	// header:'Authentication',
//     url: '/outpatient/menu',
//     method: 'get',
//     params
//   })
// }
// 暴露
export default{
login,getSecurityKey,loginOut,GetUserInfo,
insertUser,getStaff,
usersList,
deleteUser,
usersInfo,
findAttribute,
getArea,getArea2,getArea3,
addStaff,roleList,updateStaff,
getAllUser,addUser,updateUser,getuserInfo,editPwd,
AllMenu,addMenu,searchUserMenu,removeMenu,editMenu,roleMenuIds,
editRole,addRole,deleteRole,checkRole
}